﻿Public Class frmTypeeditor

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Cmd.Parameters("@name") = Me.txttype.Text

        If Me.txttypeid.Text = "" Then
            Cmd.ExecuteNonQuery("INSERT INTO Type VALUES(@name,1);")
        Else
            Cmd.Parameters("@Id") = txttypeid.Text
            Cmd.ExecuteNonQuery("UPDATE Type SET TypeName=@name WHERE TypeId=@Id")
        End If

        Me.DialogResult = Windows.Forms.DialogResult.OK
        product.loaddata()
        Me.Close()
    End Sub
End Class